<!DOCTYPE html>
<html lang="en">
<head>
    <title>后台管理系统</title>
<#include "../include/easyui.ftl"/>
    <script type="text/javascript" src="${ctx}/static/plugins/jquery/jquery.form.js"></script>
</head>
<body>
<div style="padding: 5px">
    <form id="mainform" action="${ctx }/system/user/updatePwd" method="post">
        <table>
            <tr>
                <td>原密码：</td>
                <td>
                    <input type="hidden" name="id" value="${user.id }"/>
                    <input id="oldPassword" name="oldPassword" type="password" class="required"/>
                </td>
            </tr>
            <tr>
                <td>密码：</td>
                <td><input id="plainPassword" name="plainPassword" type="password" class="required" minlength="6"
                           maxlength="20"/></td>
            </tr>
            <tr>
                <td>确认密码：</td>
                <td><input id="confirmPassword" name="confirmPassword" type="password" class="required"
                           equalTo="#plainPassword"/></td>
            </tr>
            <tr>
                <td><input id="submit" type="submit" value="submit" style="display: none"/></td>
                <td></td>
            </tr>
        </table>
    </form>
</div>
<script>
    $(function () {
        $("#oldPassword").focus();
        $("#mainform").validate({
            rules: {
                oldPassword: {
                    remote: "${ctx}/system/user/checkPwd"
                }
            },
            messages: {
                oldPassword: {
                    remote: "原密码错误"
                }
            },
            submitHandler: function (form) {
                $("#mainform").ajaxSubmit(function (data) {
                    if (data == 'success') {
                        parent.$.messager.show({title: "提示", msg: "操作成功！", position: "bottomRight"});
                        parent.d.panel('close');
                    }
                });
            }
        });

    });
</script>
</body>
</html>